<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <title></title>

  <style>
    html {
      height: 100%;
      min-height: 100%;
      overflow: hidden;
      user-select: none;
      -webkit-app-region: drag;
    }

    html body {
      background-size: 163px;
      font: 14px/21px Monaco, sans-serif;
      color: #303030;
      -webkit-font-smoothing: antialiased;
      -webkit-text-size-adjust: 100%;
      -moz-text-size-adjust: 100%;
      -ms-text-size-adjust: 100%;
      text-size-adjust: 100%;
      height: 100%;
      min-height: 100%;
      margin: 0px;
    }

    html body h4 {
      margin: 0;
    }
    .scene {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100%;
      border-radius: 20px;
      font-size: 18px;
      font-weight: bold;
      color: #303030;
      background: #ffffff;
    }
  </style>
</head>

<body>
  <div class="scene" id="scene">
    <span>营业额：</span>
    <span id="money">0</span>
  </div>

</body>
<script>
  // 创建一个WebSocket实例
  let money = 0
  let socket = new WebSocket('ws://localhost:8085');
  // 3. 监听 WebSocket 收到消息事件  
  socket.addEventListener("message", function (event) {
    document.getElementById("money").innerHTML = ''
    money = event.data
    document.getElementById("money").innerHTML = money
  });
</script>

</html>